import logging
import unittest

from api.ihrm_login_api import IHRMLoginApi
from config import BASE_DIR
from utils.assert_utils import IHRMAssertUtils
from parameterized import parameterized

# 参数化(数据驱动)
from utils.file_utils import FileUitls

data_list = FileUitls.file_read(BASE_DIR + '/data/ihrm_login_data.json')

class TestIHRMLogin(unittest.TestCase):

    @parameterized.expand(data_list)
    def test_login(self, title, req_body, success, code, msg):
        # 发起请求
        resp = IHRMLoginApi.login_request(req_body)
        # 对响应回来的数据进行断言
        IHRMAssertUtils.assert_login(self, resp, success, code, msg)
